//
//  WQEmotionsManager.swift
//  1215-自定义键盘
//
//  Created by 王先强 on 15/12/15.
//  Copyright © 2015年 王先强. All rights reserved.
//

import UIKit

class WQEmotionsManager {

    
        static let sharedEmotionManager = WQEmotionsManager()
        var emotionsPackages = [WQEmotions]()
        private init() {
        
        let path = NSBundle.mainBundle().pathForResource("emoticons.plist", ofType: nil, inDirectory: "Emoticons.bundle")!
        let dict = NSDictionary(contentsOfFile: path) as! [String: AnyObject]
        
        let packages = dict["packages"] as! NSArray
        
        let idArr = packages.valueForKey("id")
            
            //创建空的最近使用表情数组
            emotionsPackages.append(WQEmotions(dict: ["group_name_cn": "最近A"]))
            //存放相对路径的数组
            for dirString in idArr as! [String] {
                //加表情Emotions的plist文件
                let emotionsPath = NSBundle.mainBundle().pathForResource("info.plist", ofType: nil, inDirectory: "Emoticons.bundle/\(dirString)")!
                let emotionsdict = NSDictionary(contentsOfFile: emotionsPath) as! [String: AnyObject]
                
                emotionsPackages.append(WQEmotions(dict: emotionsdict))
                
                
            }
//        print(emotionsPackages)
    }
    
    
}
